package com.wx.commons;


import net.sf.json.JSONObject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.wx.core.process.WxApi;

public class WxResult {
    private static final Logger logger = LoggerFactory.getLogger(WxResult.class);

    public static boolean isOk(JSONObject jSONObject) {
        if (jSONObject.get("errcode") == null || jSONObject.get("errcode") == "0") {
            logger.error("******读取接口成功*********" + jSONObject.toString());
            return true;
        } else {
            logger.error("******微信接口错误*********" + jSONObject.toString());
            return false;
        }
    }

    public static boolean isOk(com.alibaba.fastjson.JSONObject jSONObject) {
        if (jSONObject.get("errcode") == null || jSONObject.get("errcode") == "0") {
            logger.error("******读取接口成功*********" + jSONObject.toString());
            return true;
        } else {
            logger.error("******微信接口错误*********" + jSONObject.toString());
            return false;
        }
    }

    public static void main(String[] args) {
        String accessToken = "Gwm_m0zMNuEeD2iZQYu-M1sC22KgowNjNLhSe1Eu6FuG9NtziMqFL7vs5TcHuqzAjVz-6IHA2D9U5OkxVNxnDFjtnR0Me1RA4Y5xrMZPVRg";
        String requestUrl = WxApi.getFansListUrl(accessToken, null);
       // JSONObject jSONObject = WxApi.httpsRequest(requestUrl, HttpMethod.GET, null);
       String requestUrl2 = WxApi.getRequestUrl(requestUrl, accessToken);
        System.out.println(requestUrl2);
    }
}
